package com.michael.xx.audiorecoder.utils;

import java.text.DecimalFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Locale;

public class FormatUtils {
    private static DecimalFormat sDecimalFormat = new DecimalFormat("0.00");
    private static SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss", Locale.CHINA);
    private static Date date = new Date();

    /**
     * 时间 12:12
     *
     * @param second 秒
     * @return mm:ss
     */
    public static String toTimerMMSS(long second) {
        date.setTime(second);
        return sdf.format(date);
    }

    /**
     * 任意数字准换成 时分秒
     *
     * @param time
     * @return
     */
    public static String format(long time) {
        Long hour = time / 60 / 60;
        Long min = time / 60 % 60;
        Long sec = time % 60;
        return String.format("%02d:%02d:%02d", hour, min, sec);
    }

}
